Skip to content

gh-160247: Reduce padding in _PyInstructionSequence - #160271

Merged
iritkatriel merged 2 commits into
python:mainfrom
ashm-dev:gh-160247
Nov 14, 2026
Merged

iritkatriel merged 2 commits into
python:mainfrom
ashm-dev:gh-160247

Conversation

@ashm-dev

@ashm-dev ashm-dev commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Move s_labelmap_size immediately before s_labelmap to eliminate the two alignment gaps in _PyInstructionSequence.

On the tested x86-64 GCC build, this reduces sizeof(_PyInstructionSequence) from 72 to 64 bytes without changing any field types. No compiler behavior or public API changes are intended.

Verified with a C layout check and the rebuilt interpreter. The following tests pass on a --with-pydebug build: test_compile, test_compiler_assemble, test_compiler_codegen, test_dis, test_peepholer, test_type_annotations, and test_grammar.

Closes #160247.

@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 22, 2026
@ashm-dev

Copy link
Copy Markdown
Contributor Author

Friendly ping

@ashm-dev

Copy link
Copy Markdown
Contributor Author

@iritkatriel Could you review this small _PyInstructionSequence layout change?

@iritkatriel
iritkatriel merged commit 91569eb into python:main Nov 14, 2026
59 of 60 checks passed
@ashm-dev
ashm-dev deleted the gh-160247 branch November 14, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce padding in the instruction sequence structure

2 participants